package com.algorithm;

import java.util.HashSet;
import java.util.Set;

/**
 * @author: sun.hongliang
 * @create: 2019/11/20 16:15
 */
public class ContainsDuplicateTest {

    public static void main(String[] args) {

    }

    public boolean containsDuplicate(int[] nums) {
        Set<String> set = new HashSet<>();
        for (int num : nums) {
            if (set.contains(String.valueOf(num))) {
                return true;
            }
            set.add(String.valueOf(num));
        }
        return false;
    }
}
